package guava.mapsTest;

import com.google.common.base.Predicate;
import com.google.common.collect.Maps;

import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: liuliwei
 * Date: 2017-06-07
 * Time: 上午9:39
 * Description: ${description}
 */
public class MapsTest {
    public static void main(String[] args) {
        Map<String,String> stringStringMap = Maps.newHashMap();
        stringStringMap.put("key","value");
        stringStringMap.put("key1","value1");
        stringStringMap.put("key2","value2");
        Map<String, String> stringStringMap1 = Maps.filterValues(stringStringMap, new Predicate<String>() {
            @Override
            public boolean apply(String input) {
                return input.contains("1");
            }
        });
//        Maps.uniqueIndex()
        System.out.println(stringStringMap1);

        Map<String,Map<String,String>> stringMapMap=Maps.newHashMap();
        stringMapMap.put("1",stringStringMap);
        System.out.println(Maps.filterValues(stringMapMap, new Predicate<Map<String, String>>() {
            @Override
            public boolean apply(Map<String, String> input) {
                return input.get("key").equals("value");
            }
        }));
    }
}
